﻿using UnityEngine;
using System.Collections;

/// <summary>
/// the base camp of the enemy 
/// </summary>
public class BaseCamp : MonoBehaviour 
{
    public GameObject[] m_enemyMockups;

    protected float m_waitTime;

	// Use this for initialization
	void Start () 
    {
        m_waitTime = 0.0f;
	}
	
	// Update is called once per frame
	void Update () 
    {
        if( m_waitTime <= 0.0f )
        {
            m_waitTime += MathUtil.GaussRand(1.0f, 0.8f);

            genRandomEnemy();
        }

        m_waitTime -= Time.deltaTime;
	}

    /// <summary>
    /// generate a random enemy 
    /// </summary>
    protected void genRandomEnemy()
    {
        GameObject mockup = m_enemyMockups[Random.Range(0, m_enemyMockups.Length-1)];
        
        GameObject enemy = (GameObject)Instantiate(mockup);
        enemy.transform.localPosition = transform.localPosition;
    }

}
